package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.deposit;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.api.common.enums.DictConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 保证金管理-年度基础数据
 */
@Data
@Entity
@Table(name = "t_depository_base_data_year")
@org.hibernate.annotations.Table(appliesTo = "t_depository_base_data_year", comment = "每日收益")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Where(clause = "deleted = 'N'")
@SQLDelete(sql = "update t_depository_base_data_year set deleted = 'Y' where id=?")
@SQLDeleteAll(sql = "update t_depository_base_data_year set deleted = 'Y' where id=?")
public class DepositoryBaseDataYear implements Serializable {
    private static final long serialVersionUID = 8296635901287338637L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(20) comment 'id'")
    private Integer id;

    @Column(name = "bank_id", columnDefinition = "int(20) comment '存管银行id'")
    private Integer bankId;

    @ApiModelProperty(value = "银行名称")
    @Column(name = "bank_name", columnDefinition = "varchar(255) COMMENT '银行名称'")
    private String bankName;

    @ApiModelProperty(value = "起始日期")
    @Column(name = "effect_begin_date", columnDefinition = "varchar(255) COMMENT '起始日期yyyy-MM-dd'")
    private String effectBeginDate;

    @ApiModelProperty(value = "截止日期")
    @Column(name = "effect_end_date", columnDefinition = "varchar(255) COMMENT '截止日期yyyy-MM-dd'")
    private String effectEndDate;


    @ApiModelProperty(value = "均值保证金（元）应有")
    @Column(name = "average_margin", columnDefinition = "decimal(16,4) COMMENT '均值保证金（元）应有'")
    private BigDecimal averageMargin;

    @ApiModelProperty(value = "均值银行余额（元）实有")
    @Column(name = "average_bank_balance", columnDefinition = "decimal(16,4) COMMENT '均值银行余额（元）实有'")
    private BigDecimal averageBankBalance;

    @ApiModelProperty(value = "均值存放比")
    @Column(name = "average_stowage_ratio", columnDefinition = "decimal(16,4) COMMENT '当日存放比'")
    private BigDecimal averageStowageRatio;

    @ApiModelProperty(value = "利率")
    @Column(name = "interest_rate", columnDefinition = "decimal(16,4) COMMENT '利率'")
    private BigDecimal interestRate;

    @ApiModelProperty(value = "最低存放")
    @Column(name = "deposit_floor", columnDefinition = "decimal(16,4) COMMENT '最低存放'")
    private String depositFloor;

//    @ApiModelProperty(value = "最低存放类型")
//    @Column(name = "deposit_floor_type", columnDefinition = "varchar(255) COMMENT '最低存放类 型数据字典：t_depository_floor_type '")
//    private String depositFloorType;

    @ApiModelProperty(value = "增加10%保证金所需金额（元）")
    @Column(name = "increase_10p_margin", columnDefinition = "decimal(16,4) COMMENT '增加10%保证金所需金额（元）'")
    private BigDecimal increase10pMargin;

    @ApiModelProperty(value = "单日成本")
    @Column(name = "one_day_cost", columnDefinition = "decimal(16,4) COMMENT '单日成本'")
    private BigDecimal oneDayCost;

    @ApiModelProperty(value = "预估最低存放均值（剔除）（元）")
    @Column(name = "estimated_min_deposits", columnDefinition = "decimal(16,4) COMMENT '预估最低存放均值（剔除）（元）'")
    private BigDecimal estimatedMinDeposits;

    @ApiModelProperty(value = "预估最低存放最大值（剔除）（元）")
    @Column(name = "estimated_max_deposits", columnDefinition = "decimal(16,4) COMMENT '预估最低存放最大值（剔除）（元）'")
    private BigDecimal estimatedMaxDeposits;

    @ApiModelProperty(value = "可支配金额（安全值）（元）")
    @Column(name = "safe_value", columnDefinition = "decimal(16,4) COMMENT '可支配金额（安全值）（元）'")
    private BigDecimal safeValue;

    @ApiModelProperty(value = "拟定存放（考虑影响因素）")
    @Column(name = "intended_deposit", columnDefinition = "decimal(16,4) COMMENT '拟定存放（考虑影响因素）'")
    private BigDecimal intendedDeposit;

    @ApiModelProperty(value = "拟定存放（手工调整后）")
    @Column(name = "intended_deposit_hand", columnDefinition = "decimal(16,4) COMMENT '拟定存放（手工调整后）'")
    private BigDecimal intendedDepositHand;

    @ApiModelProperty(value = "可支配金额（考虑影响因素）（元）")
    @Column(name = "safe_value_inf", columnDefinition = "decimal(16,4) COMMENT '可支配金额（考虑影响因素）（元）'")
    private BigDecimal safeValueInf;

    @ApiModelProperty(value = "拟定存放比（考虑影响因素）")
    @Column(name = "intended_deposit_hand_inf", columnDefinition = "decimal(16,4) COMMENT '拟定存放比（考虑影响因素）'")
    private BigDecimal intendedDepositHandInf;


    @ApiModelProperty(value = "备注")
    @Column(name = "memo", columnDefinition = "varchar(255) COMMENT '备注'")
    private String memo;

    @Column(name = "create_id", columnDefinition = "int DEFAULT NULL COMMENT '创建人id'")
    @ApiModelProperty(value = "创建人id")
    private Long createId;

    @ApiModelProperty(value = "创建人名称")
    @Column(name = "create_name", columnDefinition = "varchar(100) COMMENT '创建人名称'")
    private String createName;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "是否删除，字典 YesNo:（N=未删除(默认) Y=已删除)")
    @Column(name = "deleted", columnDefinition = "varchar(20) default 'N' COMMENT '是否删除，字典 yesno （N=否(默认) Y=是)'")
    private String deleted = DictConstant.NO;

}
